package com.eascs.crm.nsEditDetail.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.eascs.crm.nsEditDetail.dao.ManagementInfoDao;
import com.eascs.crm.nsEditDetail.entity.ManagementInfoEntity;

@Service
public class ManagementInfoService {
	@Autowired
	private ManagementInfoDao managementInfoDao;

	public ManagementInfoEntity save(ManagementInfoEntity entity) {
		int effectRow = managementInfoDao.insert(entity);
		if (effectRow > 0) {
			return entity;
		}
		return null;
	}

	public ManagementInfoEntity getByLoanNo(String loanNo) {
		String sql = "SELECT * from management_info t where t.loanapply_no = ?";
		return managementInfoDao.findEntity(sql, ManagementInfoEntity.class, loanNo);
	}

	public ManagementInfoEntity getById(String id) {
		return managementInfoDao.getById(ManagementInfoEntity.class, id);
	}

	public int update(ManagementInfoEntity entity) {
		return managementInfoDao.updateById(entity);
	}
}
